<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="teacherSearch" styleClass="edit">

        <rich:simpleTogglePanel label="Teacher Search Filter" switchType="ajax">

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">First name</ui:define>
                <h:inputText id="firstName" value="#{teacherList.teacher.firstName}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Last name</ui:define>
                <h:inputText id="lastName" value="#{teacherList.teacher.lastName}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Passport photo url</ui:define>
                <h:inputText id="passportPhotoUrl" value="#{teacherList.teacher.passportPhotoUrl}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Subject</ui:define>
                <h:inputText id="subject" value="#{teacherList.teacher.subject}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Qualification</ui:define>
                <h:inputText id="qualification" value="#{teacherList.teacher.qualification}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Comments</ui:define>
                <h:inputText id="comments" value="#{teacherList.teacher.comments}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Match</ui:define>
                <h:selectOneRadio id="logic" value="#{teacherList.restrictionLogicOperator}" styleClass="radio">
                    <f:selectItem itemLabel="All" itemValue="and"/>
                    <f:selectItem itemLabel="Any" itemValue="or"/>
                </h:selectOneRadio>
            </s:decorate>

        </rich:simpleTogglePanel>

        <div class="actionButtons">
            <h:commandButton id="search" value="Search" action="/TeacherList.xhtml"/>
            <s:button id="reset" value="Reset" includePageParams="false"/>
        </div>

    </h:form>

    <rich:panel>
        <f:facet name="header">Teacher Search Results (#{empty teacherList.resultList ? 0 : (teacherList.paginated ? teacherList.resultCount : teacherList.resultList.size)})</f:facet>
    <div class="results" id="teacherList">

    <h:outputText value="The teacher search returned no results."
               rendered="#{empty teacherList.resultList}"/>

    <rich:dataTable id="teacherList"
                var="_teacher"
              value="#{teacherList.resultList}"
           rendered="#{not empty teacherList.resultList}">
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{teacherList}"/>
                    <ui:param name="propertyLabel" value="Id"/>
                    <ui:param name="propertyPath" value="teacher.id"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_teacher.id}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{teacherList}"/>
                    <ui:param name="propertyLabel" value="UserAccount id"/>
                    <ui:param name="propertyPath" value="teacher.userAccount.id"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_teacher.userAccount.id}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{teacherList}"/>
                    <ui:param name="propertyLabel" value="Address by present address id id"/>
                    <ui:param name="propertyPath" value="teacher.addressByPresentAddressId.id"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_teacher.addressByPresentAddressId.id}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{teacherList}"/>
                    <ui:param name="propertyLabel" value="Address by permanent address id id"/>
                    <ui:param name="propertyPath" value="teacher.addressByPermanentAddressId.id"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_teacher.addressByPermanentAddressId.id}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{teacherList}"/>
                    <ui:param name="propertyLabel" value="First name"/>
                    <ui:param name="propertyPath" value="teacher.firstName"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_teacher.firstName}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{teacherList}"/>
                    <ui:param name="propertyLabel" value="Last name"/>
                    <ui:param name="propertyPath" value="teacher.lastName"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_teacher.lastName}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{teacherList}"/>
                    <ui:param name="propertyLabel" value="Passport photo url"/>
                    <ui:param name="propertyPath" value="teacher.passportPhotoUrl"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_teacher.passportPhotoUrl}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{teacherList}"/>
                    <ui:param name="propertyLabel" value="Subject"/>
                    <ui:param name="propertyPath" value="teacher.subject"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_teacher.subject}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{teacherList}"/>
                    <ui:param name="propertyLabel" value="Date of birth"/>
                    <ui:param name="propertyPath" value="teacher.dateOfBirth"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_teacher.dateOfBirth}">
                <s:convertDateTime type="date" dateStyle="short"/>
            </h:outputText>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{teacherList}"/>
                    <ui:param name="propertyLabel" value="Qualification"/>
                    <ui:param name="propertyPath" value="teacher.qualification"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_teacher.qualification}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{teacherList}"/>
                    <ui:param name="propertyLabel" value="Mobile number"/>
                    <ui:param name="propertyPath" value="teacher.mobileNumber"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_teacher.mobileNumber}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{teacherList}"/>
                    <ui:param name="propertyLabel" value="Contact number in case of emergency"/>
                    <ui:param name="propertyPath" value="teacher.contactNumberInCaseOfEmergency"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_teacher.contactNumberInCaseOfEmergency}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{teacherList}"/>
                    <ui:param name="propertyLabel" value="Comments"/>
                    <ui:param name="propertyPath" value="teacher.comments"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_teacher.comments}"/>
        </h:column>
        <rich:column styleClass="action">
            <f:facet name="header">Action</f:facet>
            <s:link view="/#{empty from ? 'Teacher' : from}.xhtml"
                   value="#{empty from ? 'View' : 'Select'}"
             propagation="#{empty from ? 'none' : 'default'}"
                      id="teacherViewId">
                <f:param name="teacherId"
                        value="#{_teacher.id}"/>
            </s:link>
            #{' '}
            <s:link view="/TeacherEdit.xhtml"
                   value="Edit"
             propagation="none"
                      id="teacherEdit"
                rendered="#{empty from}">
                <f:param name="teacherId"
                        value="#{_teacher.id}"/>
            </s:link>
        </rich:column>
    </rich:dataTable>

    </div>
    </rich:panel>

    <div class="tableControl">

        <s:link view="/TeacherList.xhtml"
            rendered="#{teacherList.previousExists}"
               value="#{messages.left}#{messages.left} First Page"
                  id="firstPage">
          <f:param name="firstResult" value="0"/>
        </s:link>

        <s:link view="/TeacherList.xhtml"
            rendered="#{teacherList.previousExists}"
               value="#{messages.left} Previous Page"
                  id="previousPage">
            <f:param name="firstResult"
                    value="#{teacherList.previousFirstResult}"/>
        </s:link>

        <s:link view="/TeacherList.xhtml"
            rendered="#{teacherList.nextExists}"
               value="Next Page #{messages.right}"
                  id="nextPage">
            <f:param name="firstResult"
                    value="#{teacherList.nextFirstResult}"/>
        </s:link>

        <s:link view="/TeacherList.xhtml"
            rendered="#{teacherList.nextExists}"
               value="Last Page #{messages.right}#{messages.right}"
                  id="lastPage">
            <f:param name="firstResult"
                    value="#{teacherList.lastFirstResult}"/>
        </s:link>

    </div>

    <s:div styleClass="actionButtons" rendered="#{empty from}">
        <s:button view="/TeacherEdit.xhtml"
                    id="create"
           propagation="none"
                 value="Create teacher">
            <f:param name="teacherId"/>
        </s:button>
    </s:div>

</ui:define>

</ui:composition>
